package org.ee.core.constant;

/**
 * 业务code,可以写在数据库，方面自定义
 *
 * @Author jokr
 * @Date 2025/8/22 上午11:48
 */
public enum BizCode {
    SUCCESS(00000, "成功"),
    USERNAME_EXISTS(10001, "用户名已存在"),
    USER_NOT_FOUND(10002, "用户不存在"),
    PASSWORD_ERROR(10003, "密码错误"),
    PARAM_ERROR(10004, "参数校验失败"),
    DATABASE_ERROR(20001, "数据库操作失败"),
    SYSTEM_ERROR(20002, "系统异常"),
    LOGIN_EXPIRED(30001, "登录已过期"),
    NO_PERMISSION(30002, "无访问权限"),
    BALANCE_NOT_ENOUGH(40001, "余额不足"),
    STOCK_NOT_ENOUGH(40002, "商品库存不足"),
    ORDER_INVALID(40003, "订单状态不允许操作");

    private final int code;
    private final String message;

    BizCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}
